-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Lazy*<T>
types in rustc_metadata
not care about lifetimes until decode
#97376
Conversation
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
self, Const, FnSig, GeneratorDiagnosticData, GenericPredicates, Predicate, TraitRef, Ty, | ||
}; | ||
|
||
pub trait ParameterizedOverTcx: 'static { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question: Does this really need to be : 'static
? These impls also could be impl<'a> ParameterizedOverTcx for Thing<'a> { type Value<'tcx> = Thing<'tcx>; }
, right? Because This is just encoding a higher-kinded lifetime -> type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there's no good reason why we need Self: 'static
. That is, it's not there for correctness or anything, necessarily.
I treat it more like a mnemonic, where the lifetime error you'd get is there to discourage you from constructing Lazy<Something<'not_static>>
, since there is no guarantee that the 'not_static
lifetime is not related to what you get out of lazy.decode(meta)
.
One question, but r=me |
I guess this could use a perf run too. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit d1a9a95 with merge b4f81f3aa398c1b6b271826fc9a5c488fadc565f... |
☀️ Try build successful - checks-actions |
Queued b4f81f3aa398c1b6b271826fc9a5c488fadc565f with parent 76761db, future comparison URL. |
Finished benchmarking commit (b4f81f3aa398c1b6b271826fc9a5c488fadc565f): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Footnotes |
@bors r=jackh726 |
📌 Commit d1a9a95 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (9fadabc): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
…nkov A few metadata nits Found while reading through the code. The `NOTE` is outdated now after rust-lang#97376.
…nkov A few metadata nits Found while reading through the code. The `NOTE` is outdated now after rust-lang#97376.
This allows us to remove the
'tcx
lifetime fromCrateRoot
. This is necessary because of #97287, which makes the'tcx
lifetime onTy
invariant instead of covariant, so this hack no longer holds under that PR.Introduces a trait called
ParameterizedOverTcx
which has a generic associated type that allows a type to be parameterized over that lifetime. This means we can decode, for example,Lazy<Ty<'static>>
into anyTy<'tcx>
depending on theTyCtxt<'tcx>
we pass into the decode function.